<template>
  <Modal v-model="visible"
         title="查看图片"
         :footer-hide="true"
         @on-cancel="close"
         width="50%">
    <div style="text-align: center;overflow: auto">
      <img :src="imgSrc">
    </div>
  </Modal>
</template>

<script>
export default {
  name: 'ImageModal',
  data() {
    return {
      visible: false,
      imgSrc: '',
    }
  },
  methods: {
    open(imgSrc) {
      this.resetFields();
      this.visible = true;
      this.imgSrc = imgSrc;
    },
    close() {
      this.visible = false;
    },
    resetFields() {
      this.imgSrc = '';
    }
  }
};
</script>

<style scoped>

</style>
